{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<thead><tr><th></th><th scope=col>Pregnancies</th><th scope=col>DiabetesPedigreeFunction</th><th scope=col>Age</th><th scope=col>Outcome</th><th scope=col>Glucose</th><th scope=col>BMI</th><th scope=col>BloodPressure</th><th scope=col>SkinThickness</th><th scope=col>Insulin</th><th scope=col></th></tr></thead>\n",
       "<tbody>\n",
       "\t<tr><th scope=row>392</th><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td> 1 </td><td> 1 </td><td>  1</td><td>  1</td><td>  0</td></tr>\n",
       "\t<tr><th scope=row>  1</th><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td>0  </td><td> 1 </td><td> 1 </td><td>  1</td><td>  1</td><td>  1</td></tr>\n",
       "\t<tr><th scope=row>140</th><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td> 1 </td><td> 1 </td><td>  1</td><td>  0</td><td>  1</td></tr>\n",
       "\t<tr><th scope=row>  1</th><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td> 0 </td><td> 1 </td><td>  1</td><td>  1</td><td>  1</td></tr>\n",
       "\t<tr><th scope=row>  4</th><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td>0  </td><td> 1 </td><td> 1 </td><td>  1</td><td>  0</td><td>  2</td></tr>\n",
       "\t<tr><th scope=row>  2</th><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td> 1 </td><td> 0 </td><td>  1</td><td>  0</td><td>  2</td></tr>\n",
       "\t<tr><th scope=row>192</th><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td> 1 </td><td> 1 </td><td>  0</td><td>  0</td><td>  2</td></tr>\n",
       "\t<tr><th scope=row>  1</th><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td> 0 </td><td> 1 </td><td>  1</td><td>  0</td><td>  2</td></tr>\n",
       "\t<tr><th scope=row> 26</th><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td> 1 </td><td> 0 </td><td>  0</td><td>  0</td><td>  3</td></tr>\n",
       "\t<tr><th scope=row>  2</th><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td> 0 </td><td> 1 </td><td>  0</td><td>  0</td><td>  3</td></tr>\n",
       "\t<tr><th scope=row>  7</th><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td>1  </td><td> 0 </td><td> 0 </td><td>  0</td><td>  0</td><td>  4</td></tr>\n",
       "\t<tr><th scope=row></th><td>0  </td><td>0  </td><td>0  </td><td>0  </td><td>5  </td><td>11 </td><td>35 </td><td>227</td><td>374</td><td>652</td></tr>\n",
       "</tbody>\n",
       "</table>\n"
      ],
      "text/latex": [
       "\\begin{tabular}{r|llllllllll}\n",
       "  & Pregnancies & DiabetesPedigreeFunction & Age & Outcome & Glucose & BMI & BloodPressure & SkinThickness & Insulin & \\\\\n",
       "\\hline\n",
       "\t392 & 1   & 1   & 1   & 1   & 1   &  1  &  1  &   1 &   1 &   0\\\\\n",
       "\t  1 & 1   & 1   & 1   & 1   & 0   &  1  &  1  &   1 &   1 &   1\\\\\n",
       "\t140 & 1   & 1   & 1   & 1   & 1   &  1  &  1  &   1 &   0 &   1\\\\\n",
       "\t  1 & 1   & 1   & 1   & 1   & 1   &  0  &  1  &   1 &   1 &   1\\\\\n",
       "\t  4 & 1   & 1   & 1   & 1   & 0   &  1  &  1  &   1 &   0 &   2\\\\\n",
       "\t  2 & 1   & 1   & 1   & 1   & 1   &  1  &  0  &   1 &   0 &   2\\\\\n",
       "\t192 & 1   & 1   & 1   & 1   & 1   &  1  &  1  &   0 &   0 &   2\\\\\n",
       "\t  1 & 1   & 1   & 1   & 1   & 1   &  0  &  1  &   1 &   0 &   2\\\\\n",
       "\t 26 & 1   & 1   & 1   & 1   & 1   &  1  &  0  &   0 &   0 &   3\\\\\n",
       "\t  2 & 1   & 1   & 1   & 1   & 1   &  0  &  1  &   0 &   0 &   3\\\\\n",
       "\t  7 & 1   & 1   & 1   & 1   & 1   &  0  &  0  &   0 &   0 &   4\\\\\n",
       "\t & 0   & 0   & 0   & 0   & 5   & 11  & 35  & 227 & 374 & 652\\\\\n",
       "\\end{tabular}\n"
      ],
      "text/markdown": [
       "\n",
       "| <!--/--> | Pregnancies | DiabetesPedigreeFunction | Age | Outcome | Glucose | BMI | BloodPressure | SkinThickness | Insulin |  | \n",
       "|---|---|---|---|---|---|---|---|---|---|---|---|\n",
       "| 392 | 1   | 1   | 1   | 1   | 1   |  1  |  1  |   1 |   1 |   0 | \n",
       "|   1 | 1   | 1   | 1   | 1   | 0   |  1  |  1  |   1 |   1 |   1 | \n",
       "| 140 | 1   | 1   | 1   | 1   | 1   |  1  |  1  |   1 |   0 |   1 | \n",
       "|   1 | 1   | 1   | 1   | 1   | 1   |  0  |  1  |   1 |   1 |   1 | \n",
       "|   4 | 1   | 1   | 1   | 1   | 0   |  1  |  1  |   1 |   0 |   2 | \n",
       "|   2 | 1   | 1   | 1   | 1   | 1   |  1  |  0  |   1 |   0 |   2 | \n",
       "| 192 | 1   | 1   | 1   | 1   | 1   |  1  |  1  |   0 |   0 |   2 | \n",
       "|   1 | 1   | 1   | 1   | 1   | 1   |  0  |  1  |   1 |   0 |   2 | \n",
       "|  26 | 1   | 1   | 1   | 1   | 1   |  1  |  0  |   0 |   0 |   3 | \n",
       "|   2 | 1   | 1   | 1   | 1   | 1   |  0  |  1  |   0 |   0 |   3 | \n",
       "|   7 | 1   | 1   | 1   | 1   | 1   |  0  |  0  |   0 |   0 |   4 | \n",
       "|  | 0   | 0   | 0   | 0   | 5   | 11  | 35  | 227 | 374 | 652 | \n",
       "\n",
       "\n"
      ],
      "text/plain": [
       "    Pregnancies DiabetesPedigreeFunction Age Outcome Glucose BMI BloodPressure\n",
       "392 1           1                        1   1       1        1   1           \n",
       "  1 1           1                        1   1       0        1   1           \n",
       "140 1           1                        1   1       1        1   1           \n",
       "  1 1           1                        1   1       1        0   1           \n",
       "  4 1           1                        1   1       0        1   1           \n",
       "  2 1           1                        1   1       1        1   0           \n",
       "192 1           1                        1   1       1        1   1           \n",
       "  1 1           1                        1   1       1        0   1           \n",
       " 26 1           1                        1   1       1        1   0           \n",
       "  2 1           1                        1   1       1        0   1           \n",
       "  7 1           1                        1   1       1        0   0           \n",
       "    0           0                        0   0       5       11  35           \n",
       "    SkinThickness Insulin    \n",
       "392   1             1       0\n",
       "  1   1             1       1\n",
       "140   1             0       1\n",
       "  1   1             1       1\n",
       "  4   1             0       2\n",
       "  2   1             0       2\n",
       "192   0             0       2\n",
       "  1   1             0       2\n",
       " 26   0             0       3\n",
       "  2   0             0       3\n",
       "  7   0             0       4\n",
       "    227           374     652"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "diabetes<-read.csv('../1确定缺失项/diabetes.csv')\n",
    "library(mice)\n",
    "md.pattern(diabetes)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Loading required package: colorspace\n",
      "Loading required package: grid\n",
      "Loading required package: data.table\n",
      "VIM is ready to use. \n",
      " Since version 4.0.0 the GUI is in its own package VIMGUI.\n",
      "\n",
      "          Please use the package to use the new (and old) GUI.\n",
      "\n",
      "Suggestions and bug-reports can be submitted at: https://github.com/alexkowa/VIM/issues\n",
      "\n",
      "Attaching package: 'VIM'\n",
      "\n",
      "The following object is masked from 'package:datasets':\n",
      "\n",
      "    sleep\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<strong>png:</strong> 2"
      ],
      "text/latex": [
       "\\textbf{png:} 2"
      ],
      "text/markdown": [
       "**png:** 2"
      ],
      "text/plain": [
       "png \n",
       "  2 "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "library(VIM)\n",
    "pdf(\"testPlot.pdf\")\n",
    "matrixplot(diabetes)\n",
    "dev.off()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "R",
   "language": "R",
   "name": "ir"
  },
  "language_info": {
   "codemirror_mode": "r",
   "file_extension": ".r",
   "mimetype": "text/x-r-source",
   "name": "R",
   "pygments_lexer": "r",
   "version": "3.4.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
